//
//  RedPacketTableViewCell.m
//  fxxiaoke
//
//  Created by 鞠超 on 2016/10/11.
//  Copyright © 2016年 jc. All rights reserved.
//

#import "RedPacketTableViewCell.h"

@implementation RedPacketTableViewCell

- (instancetype )initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    
    if(self)
    {
        [self p_setupView];
    }
    
    return self;
}

- (void )p_setupView
{
    self.name = [[UILabel alloc] init];
    self.name.text = @"拼手气红包";
    self.name.textColor = [UIColor blackColor];
    [self.contentView addSubview:self.name];
    
    self.view_Line = [[UIView alloc] init];
    self.view_Line.backgroundColor = [UIColor groupTableViewBackgroundColor];
    [self.contentView addSubview:self.view_Line];
    
    self.time = [[UILabel alloc] init];
    self.time.text = @"11-10 11:22";
    self.time.textColor = [UIColor grayColor];
    self.time.font = [UIFont systemFontOfSize:15.0f];
    [self.contentView addSubview:self.time];
    
    self.money = [[UILabel alloc] init];
    self.money.text = @"200.00元";
    self.money.textColor = [UIColor blackColor];
    self.money.textAlignment = NSTextAlignmentRight;
    [self.contentView addSubview:self.money];
    
    self.detail = [[UILabel alloc] init];
    self.detail.text = @"已抢完 31/31个";
    self.detail.textColor = [UIColor grayColor];
    self.detail.font = [UIFont systemFontOfSize:15.0f];
    self.detail.textAlignment = NSTextAlignmentRight;
    [self.contentView addSubview:self.detail];
    
    self.image = [[UIImageView alloc] init];
    self.image.layer.masksToBounds = YES;
    self.image.image = [UIImage imageNamed:@"Pin.png"];
    [self.contentView addSubview:self.image];
}

- (void )layoutSubviews
{
    [super layoutSubviews];
    
    self.name.frame = CGRectMake(10, 25, (SCREEN_WIDTH - 20) / 2, 20);
    
    self.time.frame = CGRectMake(10, CGRectGetMaxY(self.name.frame) + 8, (SCREEN_WIDTH - 20) / 2, 15);
    
    self.view_Line.frame = CGRectMake(10, 88.5, SCREEN_WIDTH - 10, 1.5);
    
    self.money.frame = CGRectMake(CGRectGetMaxX(self.time.frame), 25, (SCREEN_WIDTH - 20) / 2, 20);
    
    self.detail.frame = CGRectMake(CGRectGetMaxX(self.time.frame), CGRectGetMaxY(self.money.frame) + 8, (SCREEN_WIDTH - 20) / 2, 15);
}




@end
